<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>${sessionScope.title}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <script src="/plug/echarts-2.2.7/build/source/echarts.js"></script>
    <link rel="stylesheet" href="./css/x-admin.css" media="all">
    <style>
        .chat{
            background-image: url(./images/login-btn-img.png);
            width: 62px;
            height:35px;
            background: #2299ee;
            color:#fff;
            text-align: center;
            line-height:39px;
            border-radius:5px;
            margin-right:25px;
            margin-bottom:2px;
        }
        .admin-logo-box {
            width: 100%;
            height: 57px;
            position: relative;
        }
    </style>
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header header header-demo">
        <div class="layui-main">
            <div class="admin-logo-box">
                <a class="logo" href="#" title="logo" style="font-size: 16px;width: 100% ">${sessionScope.title}</a>
<%--                <div class="larry-side-menu">
                    <i class="fa fa-th-large" aria-hidden="true"></i>
                </div>--%>
            </div>

            <ul class="layui-nav" lay-filter="">
                <!-- <li class="layui-nav-item">
                                  <a href="" title="消息">
                                      <i class="layui-icon" style="top: 1px;">&#xe63a;</i>
                                  </a>
                                  </li> -->
                <%--<li class="layui-nav-item">--%>
                    <%--<a target="_blank" class="chat" href="http://wpa.qq.com/msgrd?v=3&uin=2394740093&site=qq&menu=yes"> 点我交谈</a>--%>
                <%--</li>--%>
                <li class="layui-nav-item"><img src="http://resource.dingyuankeji.shop/dingyuanlogio/logo.jpg" class="layui-circle" style="border: 2px solid #A9B7B7;" width="35px" alt=""></li>
                <li class="layui-nav-item"> <a href="javascript:;">${rec.userName}</a>
                    <dl class="layui-nav-child">
                        <!-- 二级菜单 -->
                        <%--<dd><a href="">个人信息</a></dd>--%>
                        <%--<dd><a href="#" onclick="bindingWeiXin()">绑定个人微信</a></dd>--%>
                        <c:if test="${sessionScope.userType ==1}">
                            <c:if test="${fn:contains(sessionScope.rec,'/adminSystem/uploaderweima')==true}">
                                <dd><a href="#" onclick="uploaderweima()">上传二维码</a></dd>
                            </c:if>
                        </c:if>
                        <dd><a href="#" onclick="updatePassword()">修改密码</a></dd>
                        <dd><a href="/admin/quit">切换帐号</a></dd>
                        <dd><a href="/admin/quit">退出</a></dd>

                    </dl>
                </li>
                <%--<li class="layui-nav-item x-index"><a href="/">前台首页</a></li>--%>
            </ul>
        </div>
    </div>
    <div class="layui-side layui-bg-black x-side" style="left: 0px;">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree site-demo-nav" lay-filter="side">
                <c:forEach items="${data.data}" var="data1">
                    <li class="layui-nav-item"> <a class="javascript:;" href="javascript:;"> <i class="layui-icon" style="top: 3px;">${data1.value[0].percode}</i><cite>${data1.key}</cite> </a>
                        <dl class="layui-nav-child">
                            <dd class="">
                                <c:forEach items="${data1.value}" var="data2" begin="1">
                                    <dd class="">
                                        <a href="javascript:;" _href="${data2.url}"> <cite>${data2.name}</cite> </a>
                                    </dd>
                                </c:forEach>
                            </dd>
                        </dl>
                    </li>
                </c:forEach>
            </ul>
        </div>
    </div>
    <div class="layui-tab layui-tab-card site-demo-title x-main" lay-filter="x-tab" lay-allowclose="true" style="left: 200px;border-left: solid 2px #2299ee;">
        <ul class="layui-tab-title">
            <li class="layui-this">首页<i class="layui-icon layui-unselect layui-tab-close">ဆ</i> </li>
        </ul>
        <div class="layui-tab-content site-demo site-demo-body">
            <div class="layui-tab-item layui-show">
               <iframe frameborder="0" src="/adminSystem/welcome" class="x-iframe"></iframe>
            </div>
        </div>
    </div>
    <div class="site-mobile-shade"> </div>
</div>
<script src="../admin/js/jquery.min.js" type="text/javascript" language="javascript"></script>
<script src="./lib/layui/layui.js" charset="utf-8"></script>
<script src="./js/x-admin.js"></script>
<script src="./js/x-layui.js"></script>
<script>

    layui.use(['element','layer'], function(){
        var element = layui.element;
        $ = layui.jquery;
        element = layui.element();
        layer=layui.layer;
        //导航的hover效果、二级菜单等功能，需要依赖element模块
        // larry-side-menu向左折叠
        if($(window).width()<750){
            trun = 0;
        }else{
            trun = 1;
        }

        //监听导航点击
        element.on('nav(side)', function(elem){
            console.log(elem)
            title = elem.find('cite').text();
            console.log(title)
            url = elem.find('a').attr('_href');
            console.log(url)
            // alert(url);
            for (var i = 0; i <$('.x-iframe').length; i++) {
                if($('.x-iframe').eq(i).attr('src')==url){
                    element.tabChange('x-tab', i);
                    return;
                }
            };

            res = element.tabAdd('x-tab', {
                title: title//用于演示
                ,content: '<iframe frameborder="0" src="'+url+'" class="x-iframe"></iframe>'
            });


            element.tabChange('x-tab', $('.layui-tab-title li').length-1);

            $('.layui-tab-title li').eq(0).find('i').remove();
        });
    });
    function add() {
            console.log('城')
    }
    function updatePassword() {
        x_admin_show('修改密码','/admin/passwordEdit',800,600);
    }

    function bindingWeiXin() {
        x_admin_show('绑定微信','/adminSystem/bindingWeiXin',800,600);
    }

    function uploaderweima() {
        layer.open({
            type: 2,
            title:'上传二维码',
            area: ['20%', '70%'],
            shadeClose:true,
            content: '/adminSystem/uploaderweima'
        });


        //x_admin_show('上传二维码','/adminSystem/uploaderweima',1600,800);
    }



</script>





    </body>
</html>
